package com.acertificate.util;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

import org.apache.commons.io.IOUtils;

public class SQLUtil {

	public static void main(String[] args) throws FileNotFoundException, IOException {

		String txt = IOUtils.toString(new FileInputStream(new File("f:/faxdb/faxdb.structure.new.sql")));
		String []lines = txt.split("\n");
		int index = 0;
		int count = 0;
		for (String string : lines) {
			index++;
			if(string.contains("AUTO_INCREMENT") || string.contains("Brief") || string.contains("AccountID"))
				continue;
			if(string.contains("int(")){
				if(!string.contains("DEFAULT '0'")){
					System.out.println(index + "\t" + string);
					count++;
				}
			}
			if(string.contains("varchar(")){
				if(!string.contains("DEFAULT ''")){
					System.out.println(index + "\t" + string);
					count++;
				}
			}
		}
		System.out.println(count);
	}

}
